package com.js.rtu.config;

/**
 * 错误代码列表
 * Created by wz on 2020/7/7.
 */
public class ErrConfig {

    private static final int ERR_NOT_SUPPORT = 1;
    private static final int ERR_VALUES_OUT_OF_RANGE = 2;
    private static final int ERR_CHANNEL_OUT_OF_RANGE= 3;
    private static final int TYPE_NO_DATA = 4;
    private static final int TYPE_NOT_INIT= 5;
    private static final int TYPE_REAL_ALARM= 6;
    private static final int TYPE_HISTORY_ALARM= 7;

    private static final String STR_NOT_SUPPORT = "不支持该命令字";
    private static final String STR_VALUES_OUT_OF_RANGE = "参数值超出支持范围";
    private static final String STR_CHANNEL_OUT_OF_RANGE = "通道超出支持范围";
    private static final String STR_NO_DATA = "无此时刻的历史数据";
    private static final String STR_NOT_INIT = "参数未被初始化";
    private static final String STR_REAL_ALARM = "实时报警参数异常";
    private static final String STR_HISTORY_ALARM = "报警历史数据异常";


    /**
     * 持续供电时间
     *
     * @param data 数据
     * @return 时间
     */
    public static String getErr(int data) {
        String err ="未知错误";
        switch (data){
            case ERR_NOT_SUPPORT:
                err=STR_NOT_SUPPORT;
                break;
            case ERR_VALUES_OUT_OF_RANGE:
                err=STR_VALUES_OUT_OF_RANGE;
                break;
            case ERR_CHANNEL_OUT_OF_RANGE:
                err=STR_CHANNEL_OUT_OF_RANGE;
                break;
            case TYPE_NO_DATA:
                err=STR_NO_DATA;
                break;
            case TYPE_NOT_INIT:
                err=STR_NOT_INIT;
                break;
            case TYPE_REAL_ALARM:
                err=STR_REAL_ALARM;
                break;
            case TYPE_HISTORY_ALARM:
                err=STR_HISTORY_ALARM;
                break;

        }
        return err;
    }
}
